home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 97 / CD-ROM 97 / CD-ROM 97.iso / jogos / spherical / Code / Library / collide.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-15  |  2.1 KB  |  46 lines

  1.  
  2. // Copyright (C) 2002 by Luigi Pino.  All Rights Reserved.
  3.  
  4. /***************************************************************************/
  5.  
  6. typedef struct {
  7.     bool        edge;                                                                                // Whether collision happened at the edge of line
  8.     float        distance;                                                                        // Distance from closest point of collision
  9.     float        radius;                                                                            // Radius of object
  10.     float3    closest_pts;                                                                // Closest point of collision
  11.     float3    from_pts;                                                                        // From collision points
  12.     float3    to_pts;                                                                            // To collision points
  13.     int            detected_object;                                                        // For sound checking
  14. } Collision_Struct;
  15.  
  16. typedef struct {
  17.     Collision_Struct    collision;                                                // Collision for object
  18.     float                            direction;                                                // Current direction of object
  19.     float                            jump;                                                            // Height object is off ground
  20.     float                            speed;                                                        // Speed of object in km/h
  21.     float3                        current;                                                    // Current position of object
  22.     float3                        increment;                                                // Increment of object (When doing class add Update_Increment())
  23.     float3                        previous;                                                    // Previous position of object
  24.     vector3                        vector_full;                                            // Full vector of movement
  25.     vector3                        vector_scaled;                                        // Scaled vector of movement
  26. } Movement_Struct;
  27.  
  28. /***************************************************************************/
  29.  
  30. void Collision_Bounce_2D(float3 *from, float3 *to, Movement_Struct *object);
  31.  
  32. void Collision_Edge_2D(Movement_Struct *object);
  33.  
  34. void Collision_Stay_2D(float3 *from, float3 *to, Movement_Struct *object);
  35.  
  36. bool Collision_Through_2D(float3 *from, float3 *to, Movement_Struct *object);
  37.  
  38. void Get_Closest_Point_2D(float3 *from, float3 *to, Movement_Struct *object, int detected_object);
  39.  
  40. bool Sphere_Collision_2D(Movement_Struct *object_1, Movement_Struct *object_2);
  41.  
  42. void Sphere_Collision_Calculate(Movement_Struct *object_1, Movement_Struct *object_2, float restitution_value);
  43.  
  44. bool Sphere_Collision_Check(Movement_Struct *object_1, Movement_Struct *object_2);
  45.  
  46. /***************************************************************************/